Xbasic

Object.ServerSideQueryRun Function

Syntax

N RecordsFound = <Layout>.Serversidequeryrun(c filter [,c order [,l additive [,c queryflags ]]])

Arguments

RecordsFound

Returns the number of records found by the query. If the layout is not based on an active-link table, returns -1. The layout is based on an active-link table that does not allow incremental server-side querying, returns -2. For example, an active-link table that was based on a stored procedure would not allow incremental server-side querying.

filter

The filter expression. The filter expression must use portable SQL syntax. The filter is in addition to any filter that was defined when the active-link table was defined. For example if the SELECT statement for the active-link table was SELECT * FROM customers WHERE state = 'MA', then the active-link table will always have a base filter of state = 'MA'. I.e. any filter that is specified is in addition to the base filter.

order

The order expression. The order expression must use portable SQL syntax.

additive

Specifies if the filter should be in addition to any previous filters applied using the .ServerSideQueryRun() method.

queryflags

Character

Description

The ServerSideQueryRun() Method applies an incremental filter to an active-link table.

The query is executed on the server. Contrast with <Layout>.QueryRun(), which applies an incremental filter by running a local query.

Example

The following Interactive Window session shows how the .ServerSideQueryRun() method can be used:

'assume that the 'customers' browse is based on an active-link table
p = Browse.Open("customers")
'sort data by city, without changing the filter
? p.ServerSideQueryRun("","City",.t.)
= 1000
'sort by lastname for city = 'London'
?p.ServerSideQueryRun("city='London'","lastname",.f.)
= 20
'search for title = 'manager' (additive)
'because additive is specified, the full filter is city = 'London' and title = 'manager'
'since the previous query was city = 'London'
?p.ServerSideQueryRun("title = 'manager'","",.t.)
= 5
'search for title = 'manager' (not additive)
'since the query is not additive, the full filter is title = 'manager' (i.e. previous queries are ignored)
?p.ServerSideQueryRun("title = 'manager'","",.f.)
= 345

See Also